package com.ykt.controller;

import com.ykt.common.utils.ModelUtil;
import com.ykt.model.Order;
import com.ykt.model.OrderItem;

import java.util.HashSet;
import java.util.Set;

/**
 * 程序启动欢迎页
 *
 * @author long.hua
 * @version 1.0.0
 * @since 2016-01-10 01:28
 */
public class WelcomeController extends BaseController{

    public void index(){
        renderJson("RShop Api is Ok!");
    }


    public void testReqParam(){
        renderText(getPara("name") + getPara("form") + getPara("age"));
    }


    public void testModelUtil(){
        Order order = new Order();

        OrderItem item = new OrderItem();
        item.put("order_id", "123");
        item.put("goods_name", "pingguo");

        order.put("user_name", "xxxx");
        order.put("order_item", item);

        Set<String> rawSet= new HashSet<>();
        rawSet.add("order_id");

        Set<String> upSet= new HashSet<>();
        upSet.add("goods_name");
        ModelUtil.toHumpName(order, upSet, rawSet);

        rawSet.add("order_id");
        ModelUtil.toUnderlineName(order, upSet, rawSet);
    }

}
